<?php
/* 
 * ********* CVS HEADER ********* 
 * 
 * $RCSfile: admgrouphiera.php,v $ 
 * $Date: 2005/08/29 13:21:42 $ 
 * $Revision: 1.2 $ 
 * 
 * ********* CVS HEADER ********* 
 */
include("environnement/$session[environnement]/header.php");
require_once(get_path_module("admin")); 
$pc = new panneau_controle(); 
$pc->calculRubriqueParFonction('admgroupliste'); 
echo $pc->retourneEntete();
?>
<center>HIERARCHIE DU GROUPE</center><br>
<?php
$query="SELECT groupe.id AS id_groupe,groupe.nom AS nom,groupe.description AS description,environnement.nom AS environnement FROM groupe,environnement WHERE groupe.id_environnement=environnement.id AND groupe.id='$argid' GROUP BY groupe.id";
$result=rportalrequete($query) or die ("ERREUR 0041");
if($row=rportalligne($result))
{
	echo "Nom : $row[nom]<br>\n";
	echo "Description : $row[description]<br>\n";
	echo "Environnement : $row[environnement]<br>\n";
	echo "<a href=\"?op=admgroupmod&argid=$row[id_groupe]\">modifier les informations de ce groupe</a><br>\n";
}
?>
<form method="post" action="?op=admgrouphieramaj">
<table border="0" cellspacing="0" cellpadding="0">
	<tr>
	<th>Groupe</th>
	<th></th>
	</tr>
	
<?php
echo "<input type=\"hidden\" name=\"idg\" value=\"$argid\">";
$query="SELECT id_groupe AS id FROM hierarchie WHERE id_groupe_dessus='$argid' AND id_groupe!='$argid' ORDER BY id_groupe";
$result=rportalrequete($query) or die ("ERREUR 0042");
$dessous=rportalligne($result);
$query="SELECT id_groupe_dessus AS id FROM hierarchie WHERE id_groupe='$argid' AND id_groupe_dessus!='$argid' ORDER BY id_groupe_dessus";
$result3=rportalrequete($query) or die ("ERREUR 0043");
$dessus=rportalligne($result3);
$query="SELECT * FROM groupe WHERE id!='$argid' ORDER BY id";
$result2=rportalrequete($query) or die ("ERREUR 0044");

while($row=rportalligne($result2))
{
	echo "<tr><td>$row[nom]</td>\n<td>";
	if($row[id]==$dessous[id])
	{
		echo "<input type=\"radio\" name=\"argid$row[id]\" value=\"0\" checked>dessous \n";
		echo "<input type=\"radio\" name=\"argid$row[id]\" value=\"1\">dessus \n";
		echo "<input type=\"radio\" name=\"argid$row[id]\" value=\"2\">rien \n";
		$dessous=rportalligne($result);
	}
	else if($row[id]==$dessus[id])
	{
		echo "<input type=\"radio\" name=\"argid$row[id]\" value=\"3\">dessous \n";
		echo "<input type=\"radio\" name=\"argid$row[id]\" value=\"0\" checked>dessus \n";
		echo "<input type=\"radio\" name=\"argid$row[id]\" value=\"4\">rien \n";
		$dessus=rportalligne($result3);
	}
	else
	{
		echo "<input type=\"radio\" name=\"argid$row[id]\" value=\"5\">dessous \n";
		echo "<input type=\"radio\" name=\"argid$row[id]\" value=\"6\">dessus \n";
		echo "<input type=\"radio\" name=\"argid$row[id]\" value=\"0\" checked>rien \n";
	}
	echo "</td></tr>\n";
	
}
?>
<tr>
    <td>&nbsp;</td>
    <td>
        <input type="submit" name="Submit" value="Envoyer">
      </td>
  </tr>
</table>
</form>
<?php
include("environnement/$session[environnement]/footer.php");
?>